package com.yazi.mxz.common.entity.beans;

import com.myframework.smhj.hibernate.Entity;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.SEQUENCE;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Material entity. @author MyEclipse Persistence Tools
 */
@javax.persistence.Entity
@Table(name = "MXZ_MATERIAL", schema = "MXZ")
public class Material extends Entity implements java.io.Serializable {

	// Fields

	private Long materialId;
	private Cook cook;
	private Integer type;
	private String name;
	private String amount;

	// Constructors

	/** default constructor */
	public Material() {
	}

	/** minimal constructor */
	public Material(Cook cook, Integer type, String name) {
		this.cook = cook;
		this.type = type;
		this.name = name;
	}

	/** full constructor */
	public Material(Cook cook, Integer type, String name, String amount) {
		this.cook = cook;
		this.type = type;
		this.name = name;
		this.amount = amount;
	}

	// Property accessors
	@SequenceGenerator(name = "generator", sequenceName = "SEQ_MATERIAL")
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "MATERIAL_ID", unique = true, nullable = false, precision = 15, scale = 0)
	public Long getMaterialId() {
		return this.materialId;
	}

	public void setMaterialId(Long materialId) {
		this.materialId = materialId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "COOK_ID", nullable = false)
	public Cook getCook() {
		return this.cook;
	}

	public void setCook(Cook cook) {
		this.cook = cook;
	}

	@Column(name = "TYPE", nullable = false, precision = 2, scale = 0)
	public Integer getType() {
		return this.type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Column(name = "NAME", nullable = false, length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "AMOUNT", length = 50)
	public String getAmount() {
		return this.amount;
	}

	public void setAmount(String amount) {
		this.amount = amount;
	}

}